const scoreDom = document.querySelector(".score");
const bestScoreDom = document.querySelector(".bestScore");
let total_score = 0;

//渲染最好成绩
localStorage.getItem('bestScore-easy') ? bestScoreDom.innerHTML = `你的最好成绩:${localStorage.getItem('bestScore-easy')}` : bestScoreDom.innerHTML = `你的最好成绩:0`


setTimeout(() => {
    let timer = setInterval(() => {
        if (bg.xspeed == 0) {
            clearInterval(timer)
            //存入本地最好成绩
            if (localStorage.getItem("bestScore-easy") == false || localStorage.getItem('bestScore-easy') < total_score) {
                localStorage.setItem("bestScore-easy", total_score)
                bestScoreDom.innerHTML = `你的最好成绩:${localStorage.getItem('bestScore-easy')}`
            }
            return
        }
        total_score++
        scoreDom.innerHTML = `得分:${total_score}`
    }, producer.tick);
}, 7500)

